import { createRouter, createWebHistory } from 'vue-router';
import Login from '../components/Login.vue';
import HomeView from '../views/HomeView.vue';
import AboutView from '../views/AboutView.vue';
// import Index from '../components/index/home.vue';
// import Index2 from '../components/index/home2.vue';
import WelcomeView from '../components/WelcomeItem.vue';
import userView from '../components/account/user/user.vue';
import merchantView from '../components/account/merchant/merchant.vue';
import riderView from '../components/account/rider/rider.vue';
import customerView from '../components/account/customer/customer.vue';

import userListView from '../components/account/user/user_list.vue';
import userDetailView from '../components/account/user/user_detail.vue';

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'Home',
      component: HomeView,
      redirect: '/welcome',
      meta: {
        title: '首页',
        icon: 'house'
      },
      children: [
        {
          path: '/welcome',
          name: 'Welcome',
          component: WelcomeView,
          meta: {
            title: '首页',
            icon: 'PieChart'
          }
        },
        {
          path: '/account',
          name: 'account',
          meta: {
            title: '账户管理',
            icon: 'PieChart'
          },
          children: [
            {
              path: '/user',
              name: 'user',
              component: userView,
              meta: {
                title: '用户管理',
                icon: 'IconMenu'
              },
              children: [
                // 确保有一个默认路径，如 'overview'
                { path: '', redirect: 'user_list' },
                {
                  path: '/user_list',
                  name: 'user_list',
                  component: userListView,
                  meta: {
                    title: '用户信息',
                    icon: 'IconMenu',
                    isHidden: true,//是否不在二级菜单中显示页面（按照结构属于三级菜单，界面上属于二级菜单）
                  } 
                },
                {
                  path: '/user_detail',
                  name: 'user_detail',
                  component: userDetailView,
                  meta: {
                    title: '用户详情',
                    icon: 'IconMenu',
                    isHidden: true,//是否不在二级菜单中显示页面（按照结构属于三级菜单，界面上属于二级菜单）
                  } 
                },
                {
                  path: '/order_list',
                  name: 'order_list',
                  component: import('../components/account/user/order_list.vue'),
                  meta: {
                    title: '订单列表',
                    icon: 'IconMenu',
                    isHidden: true,//是否不在二级菜单中显示页面（按照结构属于三级菜单，界面上属于二级菜单）
                  } 
                },
                {
                  path: '/order_detail',
                  name: 'order_detail',
                  component: import('../components/account/user/order_detail.vue'),
                  meta: {
                    title: '订单详情',
                    icon: 'IconMenu',
                    isHidden: true,//是否不在二级菜单中显示页面（按照结构属于三级菜单，界面上属于二级菜单）
                  } 
                },
                {
                  path: '/order_progress',
                  name: 'order_progress',
                  component: import('../components/account/user/order_progress.vue'),
                  meta: {
                    title: '订单进度',
                    icon: 'IconMenu',
                    isHidden: true,//是否不在二级菜单中显示页面（按照结构属于三级菜单，界面上属于二级菜单）
                  } 
                },
                
                {
                  path: '/invoice_list',
                  name: 'invoice_list',
                  component: import('../components/account/user/invoice_list.vue'),
                  meta: {
                    title: '发票列表',
                    icon: 'IconMenu',
                    isHidden: true,//是否不在二级菜单中显示页面（按照结构属于三级菜单，界面上属于二级菜单）
                  } 
                },
                {
                  path: '/vip_list',
                  name: 'vip_list',
                  component: import('../components/account/user/vip_list.vue'),
                  meta: {
                    title: '会员',
                    icon: 'IconMenu',
                    isHidden: true,//是否不在二级菜单中显示页面（按照结构属于三级菜单，界面上属于二级菜单）
                  } 
                },
                {
                  path: '/account_status_list',
                  name: 'account_status_list',
                  component: import('../components/account/user/account_status_list.vue'),
                  meta: {
                    title: '账户状态',
                    icon: 'IconMenu',
                    isHidden: true,//是否不在二级菜单中显示页面（按照结构属于三级菜单，界面上属于二级菜单）
                  } 
                },
              ]
            },
            {
              path: '/merchant',
              name: 'merchant',
              component: merchantView,
              meta: {
                title: '商户管理',
                icon: 'IconMenu'
              }
            },
            {
              path: '/rider',
              name: 'rider',
              component: riderView,
              meta: {
                title: '骑士管理',
                icon: 'IconMenu'
              }
            },
            {
              path: '/customer',
              name: 'customer',
              component: customerView,
              meta: {
                title: '客服管理',
                icon: 'IconMenu'
              }
            },

          ]
        },
        {
          path: '/about',
          name: 'about',
          component: AboutView,
          meta: {
            title: '关于我们',
            icon: 'menu'
          }
        },
      ]
    },
    {
      path: '/login',
      name: 'Login',
      component: Login
    }
  ]
});

export default router;